﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using  The_Square_Saga.Objects.Interface;

namespace The_Square_Saga.Objects
{
    abstract class MovableGameEntity : GameEntity, IGameEntity
    {
        /// <summary>
        /// The velocity for move
        /// The default velocity is 3
        /// </summary>
        private Vector2 velocity;
        /// <summary>
        /// The velocity for move
        /// </summary>
        public Vector2 Velocity
        {
            get { return velocity; }
            set { velocity = value; }
        }

        /// <summary>
        /// a direction  to move
        /// </summary>
        protected Vector2 direction;
        /// <summary>
        /// a direction  to move
        /// </summary>
        public Vector2 Direction
        {
            get { return direction; }
            set { direction = value; }
        }

        /// <summary>
        /// Constructors
        /// </summary>
        /// <param name="image">an image</param>
        /// <param name="position">A position</param>
        /// <param name="frameSize">The width and height of the frame</param>
        /// <param name="velocity">A velocity</param>
        /// <param name="isAnimated">Check if this object is animated</param>
        public MovableGameEntity(Texture2D image, Vector2 position)
            : base(image, position)
        {
            this.direction = Vector2.Zero;
            Velocity = new Vector2(3, 3);
        }

        /// <summary>
        /// Moves the GameEntity on especified direction
        /// </summary>
        protected void ApplyMovement()
        {
            this.position += velocity * direction;
        }

        public override void draw(SpriteBatch spriteBatch)
        {
           spriteBatch.Draw(this.getImage(), this.position, Color.White);
        }

    }
}
